package com.mzz.behavior.fatherandson.template;

/**
 * 模板模式测试用例
 *
 * @author xushijian
 * @date 18/5/16
 */
public class TemplateDemo {

    public static void main(String[] args) {

        Book book = new Book();
        book.setBookName("Thinking in Java");
        book.setPages(111);
        book.setPrice(222);
        book.setAuthor("Bruce Eckel 111");
        book.setIsbn("9787111213826");
        XMLFormatter xmlFormatter = new XMLFormatter();
        String result = xmlFormatter.formatBook(book);
        System.out.println(result);
        JSONFormatter jsonFormatter = new JSONFormatter();
        result = jsonFormatter.formatBook(book);
        System.out.println(result);
    }
}
